<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var y = 2022
        var a = 12
        var num = 0
        switch (a) {
            case 12:
                console.log(num = num + 31)
            case 11:
                console.log(num = num + 30)
            case 10:
                console.log(num = num + 31)
            case 9:
                console.log(num = num + 30)
            case 8:
                console.log(num = num + 31)
            case 7:
                console.log(num = num + 31)
            case 6:
                console.log(num = num + 30)
            case 5:
                console.log(num = num + 31)
            case 4:
                console.log(num = num + 30)
            case 3:
                console.log(num = num + 31)
            case 2:
                if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
                    console.log('闰年')
                    console.log(num = num + 29)
                } else {
                    console.log('平年')
                    console.log(num = num + 28)
                }
            case 1:
                console.log(num = num + 31)
        }


    </script>
</body>

</html>